package org.honeyweb.gsoc.components;

import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;
import org.apache.tapestry5.BindingConstants;

/**
 * Layout component for pages of application gsoc.
 */
@IncludeStylesheet("context:layout/layout.css")
public class Layout
{
    /** The page title, for the <title> element and the <h1> element. */
    @Property
    @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
    private String title;

    @Property
    private String pageName;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private String sidebarTitle;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private Block sidebar;

    @Inject
    private ComponentResources resources;
    
    @Property
    private String[] _subjects = {"Use Honeypots", "Results", "Statistics"};

    private String useHoneypots = "<a href=\"listHoneypot\">Use Honeypot</a>";
    private String results = "<a href=\"results\">Results</a>";
    private String statistics = "<a href=\"notImplementedYet\">General statistics</a><br/><a href=\"notImplementedYet\">Personal statistics</a><br/><a href=\"notImplementedYet\">Organisation statistics</a>";


	public String[] getDetails()
    {
        return new String[]{useHoneypots ,results ,statistics};
    }


    public String getClassForPageName()
    {
      return resources.getPageName().equalsIgnoreCase(pageName)
             ? "current_page_item"
             : null;
    }

    public String[] getPageNames()
    {
      return new String[] {"Connect", "Home", "About", "Contact" };
    }
    
    public String[] getPageNamesConnected()
    {
      return new String[] {"Logout", "Home", "About", "Contact" };
    }
    
    public boolean getTitleConnect(){
    	if(resources.getPageName().equalsIgnoreCase("connect")){
    		return false;
    	}
    	else{
    		return true;
    	}
    }
}
